package com.hottop.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.hottop.common.annotation.Log;
import com.hottop.common.core.controller.BaseController;
import com.hottop.common.core.domain.AjaxResult;
import com.hottop.common.enums.BusinessType;
import com.hottop.system.domain.SysHotsplatform;
import com.hottop.system.service.ISysHotsplatformService;
import com.hottop.common.utils.poi.ExcelUtil;
import com.hottop.common.core.page.TableDataInfo;

/**
 * 更多热搜平台数据Controller
 * 
 * @author ruoyi
 * @date 2022-02-19
 */
@RestController
@RequestMapping("/system/hotsplatform")
public class SysHotsplatformController extends BaseController
{
    @Autowired
    private ISysHotsplatformService sysHotsplatformService;

    /**
     * 查询更多热搜平台数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:hotsplatform:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysHotsplatform sysHotsplatform)
    {
        startPage();
        List<SysHotsplatform> list = sysHotsplatformService.selectSysHotsplatformList(sysHotsplatform);
        return getDataTable(list);
    }

    /**
     * 导出更多热搜平台数据列表
     */
    @PreAuthorize("@ss.hasPermi('system:hotsplatform:export')")
    @Log(title = "更多热搜平台数据", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysHotsplatform sysHotsplatform)
    {
        List<SysHotsplatform> list = sysHotsplatformService.selectSysHotsplatformList(sysHotsplatform);
        ExcelUtil<SysHotsplatform> util = new ExcelUtil<SysHotsplatform>(SysHotsplatform.class);
        util.exportExcel(response, list, "更多热搜平台数据数据");
    }

    /**
     * 获取更多热搜平台数据详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:hotsplatform:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(sysHotsplatformService.selectSysHotsplatformById(id));
    }

    /**
     * 新增更多热搜平台数据
     */
    @PreAuthorize("@ss.hasPermi('system:hotsplatform:add')")
    @Log(title = "更多热搜平台数据", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody SysHotsplatform sysHotsplatform)
    {
        return toAjax(sysHotsplatformService.insertSysHotsplatform(sysHotsplatform));
    }

    /**
     * 修改更多热搜平台数据
     */
    @PreAuthorize("@ss.hasPermi('system:hotsplatform:edit')")
    @Log(title = "更多热搜平台数据", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody SysHotsplatform sysHotsplatform)
    {
        return toAjax(sysHotsplatformService.updateSysHotsplatform(sysHotsplatform));
    }

    /**
     * 删除更多热搜平台数据
     */
    @PreAuthorize("@ss.hasPermi('system:hotsplatform:remove')")
    @Log(title = "更多热搜平台数据", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(sysHotsplatformService.deleteSysHotsplatformByIds(ids));
    }
}
